#!/bin/bash

#循环累加100以内的所有自然数
n=1
sum=0
while [ $n -le 100 ]
do
    sum=$((sum+$n))
    n=$(($n+1))
done
echo "sum=$sum"

#死循环与跳出循环
while true
do
    read -p "输入100跳出循环:" n
    if [ $n -eq 100 ]
    then
        break
    fi
done

#continue
files=`ls`
for f in $files
do
    if [ -r $f ]
    then
        continue
    fi
    echo "文件[$f]不可读"
done

#until
n=1
sum=0
until [ $n -gt 100 ]
do
    sum=$((sum+$n))
    n=$(($n+1))
done
echo "sum=$sum"